/**
 * 微信分享相关
 * @type {天明}
 * @type {{WeixinShare: wx.WeixinShare}}
 */
WeixinShare = function (share) {
    wx.config({
        debug: false,
        appId: share.code.appId,
        timestamp: share.code.timestamp,
        nonceStr: share.code.nonceStr,
        signature: share.code.signature,
        jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline']
    });
    wx.ready(function() {
        wx.checkJsApi({
            jsApiList: [
                'onMenuShareAppMessage'
            ],
            success: function (res) {
            }
        });
        //分享到朋友圈
        wx.onMenuShareTimeline({
            title: share.info.share_title,
            link: share.info.share_url,
            imgUrl: share.info.share_img,
            success: function () {
                layer.msg('分享成功');
            },
            cancel: function () {}
        });
        //分享给朋友
        wx.onMenuShareAppMessage({
            title: share.info.share_title,
            desc: share.info.share_content,
            link:share.info.share_url,
            imgUrl:share.info.share_img,
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                layer.msg('分享成功');
            },
            cancel: function () {}
        });
        //分享到QQ
        wx.onMenuShareQQ({
            title: share.info.share_title,
            desc: share.info.share_content,
            link:share.info.share_url,
            imgUrl:share.info.share_img,
            success: function () {
                layer.msg('分享成功');
            },
            cancel: function () {}
        });
        //分享到腾讯微博
        wx.onMenuShareWeibo({
            title: share.info.share_title,
            link: share.info.share_url,
            imgUrl: share.info.share_img,
            success: function () {
                layer.msg('分享成功');
            },
            cancel: function () {}
        });
        //分享到qq空间
        wx.onMenuShareQZone({
            title: share.info.share_title,
            link: share.info.share_url,
            imgUrl: share.info.share_img,
            success: function () {
                layer.msg('分享成功');
            },
            cancel: function () {}
        });
    });
}